<?php

namespace Database\Factories;

use App\Models\Course;
use App\Models\Teacher;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Course>
 */
class CourseFactory extends Factory
{
    protected $model = Course::class;
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition()
    {
        $teacherIds = Teacher::all()->pluck('id');
        return [
            'name' => fake()->randomElement(['Java', 'Python', 'C++', 'C#', 'JavaScript'
                , 'PHP', 'Ruby', 'Swift', 'Kotlin', 'Go', 'Rust'
                , 'Scala', 'Perl', 'Lua', 'Haskell', 'Erlang'
                , 'Pascal', 'Objective-C', 'Assembly Language', 'SQL', 'HTML', 'CSS', 'JSON']),
            'teacher_id' => $teacherIds->random(),
            'description' => fake()->sentence(),
            'start_time' => fake()->dateTimeBetween('-1 year', 'now'),
            'end_time' => fake()->dateTimeBetween('now', '+1 year'),
        ];
    }
}
